using System;

namespace AutoUpdater
{
    /// <summary>
    /// 升级状态枚举
    /// </summary>
    //public enum UpgradeStatus
    //{
    //    Starting,                // 初始化
    //    PreUpgradeSuccess,       // 升级前检查成功
    //    PreUpgradeFailed,        // 升级前检查失败
    //    PreUpgradeVersionFailed, // 版本解析失败
    //    PreUpgradeVersionEqual,  // 版本相同
    //    Downloading,             // 下载中
    //    DownloadSuccess,         // 下载成功
    //    DownloadFailed,          // 下载失败
    //    DownloadRetry,           // 下载重试
    //    Upgrading,               // 安装中
    //    UpgradeSuccess,          // 安装成功
    //    UpgradeFailed,           // 安装失败
    //    UpgradeDelay             // 升级推迟
    //}

    /// <summary>
    /// 服务器升级配置模型
    /// </summary>
    public class ServerUpgradeConfig
    {
        public string UpgradeFileVersion { get; set; }
        public string UpgradeFileName { get; set; }
        public string UpgradeFileUrl { get; set; }
        public string UpgradeFileMD5 { get; set; }
        public string UpgradeFileDescription { get; set; }
        public bool ForceUpgrade { get; set; }
        public bool ForceSystemRestart { get; set; }

        /// <summary>
        /// 获取清理后的版本号（去除V前缀）
        /// </summary>
        public string GetCleanVersion()
        {
            if (string.IsNullOrEmpty(UpgradeFileVersion)) return "";
            return UpgradeFileVersion.StartsWith("V", StringComparison.OrdinalIgnoreCase)
                ? UpgradeFileVersion.Substring(1)
                : UpgradeFileVersion;
        }
    }

    /// <summary>
    /// 本地升级配置模型
    /// </summary>
    //public class LocalUpgradeConfig
    //{
    //    public string UpgradeServerUrl { get; set; }
    //    public DateTime LastUpgradeTime { get; set; }
    //    public string LastUpgradeFileName { get; set; }
    //    public string LastUpgradeFileUrl { get; set; }
    //    public string UpgradeStatus { get; set; }
    //    public int UpgradePostpone { get; set; }
    //}
}
